<template>
  <el-upload
    class="upload-demo"
    action="https://jsonplaceholder.typicode.com/posts/"
    multiple
    :limit="3"
    :file-list="fileList"
    :on-success="handleAvatarSuccess"
  >
    <img v-if="imageUrl" :src="imageUrl" class="avatar" />
    <el-button type="primary">上传</el-button>
  </el-upload>
  <button @click="fn">点击</button>
</template>
<script>
import { ref } from "vue";
export default {
  setup() {
    const fileList = ref();
    const imageUrl = ref("");
    const file = ref();
    const fn = () => {
      console.log(fileList.value);
    };
    const handleAvatarSuccess = (res, file) => {
      console.log(res);
      console.log(file.name);
    };
    // const beforeAvatarUpload = (file) => {
    //   console.log(file);
    // };
    // const upData = () => {
    //   console.log(1);
    // };
    return {
      fileList,
      imageUrl,
      file,
      fn,
      handleAvatarSuccess,
      //   beforeAvatarUpload,
      //   upData,
    };
  },
};
</script>